﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Sprout.Schedule.Web.Attributes;
using Sprout.Schedule.Web.Models;
using Sprout.Schedule.Web.Utils;

namespace Sprout.Schedule.Web.Controllers
{
    /// <summary>
    /// 基础控制器
    /// </summary>
    [WebApiResultMiddleware]
    [ExceptionFilter]
    [Validation]
    [ApiController]
    [Route("[controller]/[action]")]
    public class BaseController : Controller
    {
        private LoginUserDto loginUser;
        /// <summary>
        /// 登录用户
        /// </summary>
        public LoginUserDto LoginUser
        {
            get
            {
                if (loginUser == null)
                {
                    loginUser = LoginHelper.GetLoginUser(base.Request.HttpContext);
                }
                return loginUser;
            }
        }
    }
}